Skip to content

Conversation

@nstilt1
Copy link
Contributor

@nstilt1 nstilt1 commented Jan 12, 2026

It does not build because it requires one change to rand_core#44, and the Cargo.toml needs to be updated.

Changes

fn set_stream(stream_id: S) {
  self.stream = S.into();
  if self.index != 64 {
    // generate_and_set is called, resulting in
    self.block_pos += 4;
    self.index = self.index; // no change to the index, but change to the block_pos
  }
}
    • I had a test that had repeated set_stream() calls and the only way to replicate it was to manually find the word_pos that resulted from each call. We can remove this test or at the very least reduce the test, since I had to add more assertions to figure out what was going on in the previous implementation.
  • Update get_block_pos() to return the current block_pos instead of returning block_pos + 4 due to generate() calls incrementing the pos by 4.
    • This is not a breaking change since get_block_pos() was not implemented for rand_chacha, but it is a breaking change for anyone who was using get_block_pos() from the prerelease versions.
  • Update docs to explain that set_stream() nullifies any calls made to set_word_pos() or set_block_pos().

Regarding #438

@nstilt1 nstilt1 marked this pull request as draft January 12, 2026 18:57
cipher = { version = "0.5.0-rc.3", optional = true, features = ["stream-wrapper"] }
rand_core = { version = "0.10.0-rc-3", optional = true, default-features = false }
# rand_core = { version = "0.10.0-rc-3", optional = true, default-features = false }
rand_core = { path = "../../rand_core", optional = true, default-features = false}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NIT:
a way to make it work for everyone (and CI) is to put a patch section in the workspace's Cargo.toml instead:

[patch.crates-io]
# https://github.com/rust-random/rand_core/pull/44
rand_core = { git = "https://github.com/rust-random/rand_core.git", branch = "push-xzmlvzwurnrl" }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants